﻿using ICSharpCode.AvalonEdit.CodeCompletion;
using System.Collections.Generic;
using System.ComponentModel;

namespace NFox.Pyeditor.Runtime
{
    public class OverloadProvider : IOverloadProvider
    {

        private List<string> _lst;
        private string _text;

        public OverloadProvider(Types.Valuetype type)
        {
            _lst = type.Overloads;
            _text = type.Text;
        }

        public int Count { get { return _lst.Count; } }

        public object CurrentContent { get { return _lst[_sid]; } }

        public object CurrentHeader { get { return $"{_text}"; } }

        public string CurrentIndexText { get { return $"第{_sid + 1}个,共{Count}个"; } }

        private int _sid;
        public int SelectedIndex
        {
            get
            {
                return _sid;
            }
            set
            {
                _sid = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedIndex"));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CurrentIndexText"));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CurrentContent"));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;


    }
}
